{
LANG : PASCAL
PROB : events
}

program EVENTS;
const
  fi = 'events.in';
  fo = 'events.out';
  maxc = 200001;
  max = 10000;
type
  dur = record
          start, leng : longint;
        end;
var
  d : array[0..maxc] of integer;
  e : array[1..max] of dur;
  n, m, maximum : longint;

procedure inp;
var
  i : longint;
begin
  read(n);
  m := -1;
  for i := 1 to n do
    with e[i] do
    begin
      read(start, leng);
      if m < start + leng - 1 then m := start + leng - 1;
    end;
end;

procedure swap(i, j : longint);
var
  temp : dur;
begin
  temp := e[i];
  e[i] := e[j];
  e[j] := temp;
end;

procedure sort(l, r : longint);
var
  i, j, k : longint;
begin
  if l >= r then exit;
  i := l;
  j := r;
  k := e[l+random(r-l+1)].start;
  repeat
    while e[i].start < k do inc(i);
    while e[j].start > k do dec(j);
    if i <= j then
    begin
      swap(i, j);
      inc(i); dec(j);
    end;
  until i > j;
  sort(i, r); sort(l, j);
end;

procedure process;
var
  i, j, k : longint;
begin
  maximum := -1;
  fillchar(d, sizeof(d), 0);
  j := 1;
  for i := 1 to m do
  begin
    if d[i-1] > d[i] then d[i] := d[i-1];
    while (j <= n) and (e[j].start = i) do
    begin
      k := i+e[j].leng-1;
      if d[k] < d[i-1]+1 then
      begin
        d[k] := d[i-1]+1;
        if d[k] > maximum then maximum := d[k];
      end;
      inc(j);
    end;
  end;
end;

begin
  randomize;
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);
  inp;
  sort(1, n);
  process;
  writeln(maximum);
  close(output);
  close(input);
end.